package com.gxa.controller;

import com.gxa.common.base.LayuiResultJson;
import com.gxa.common.base.Result;
import com.gxa.domain.entity.Member;
import com.gxa.service.Impl.MemberServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/member")
public class MemberController {
    @Autowired
    MemberServiceImpl memberService;

    //查询所有用户
    @RequestMapping(value = "/chaXunAll",method = RequestMethod.GET)
    @ResponseBody
    public List<Member> chaXunAll(Member member) {
        List<Member> members = memberService.chaXunAll();
        return members;
    }

    //新增
    @RequestMapping(value = "/xinZengById",method = RequestMethod.POST)
    @ResponseBody
    public Result xinZengById(@RequestBody Member member){
        return memberService.xinZengById(member);
    }

    @RequestMapping(value = "/shanChuById",method = RequestMethod.POST)
    @ResponseBody
    public Result shanChuById(Member id){
        return memberService.xinZengById(id);
    }

    @RequestMapping(value = "/gengXinById",method = RequestMethod.POST)
    @ResponseBody
    public Result gengXinById(@RequestBody Member memberUpdateDto){
      return memberService.xinZengById(memberUpdateDto);
    }

    @RequestMapping(value = "/chaXunFenYe",method = RequestMethod.GET)
    @ResponseBody
    public LayuiResultJson chaXunFenYe(Integer page,Integer limit){
        return memberService.chaXunFenYe(page,limit);
    }
}
